#ifndef STATUSNOTIFIERMODEL_H
#define STATUSNOTIFIERMODEL_H
#include <QStandardItemModel>
#include "statusnotifieritemsource.h"

class StatusNotifierModel : public QStandardItemModel
{
    Q_OBJECT
public:
    enum Role {
        Id=Qt::UserRole + 1,
        WindowId,
        Category,
        Status,
        StatusChanged,
        Title,
        TitleChanged,
        ToolTipIcon,
        ToolTipSubTitle,
        ToolTipTitle,
        ToolTipChanged,
        Icon,
        IconName,
        IconThemePath,
        IconsChanged,
        OverlayIconName,
        AttentionIcon,
        AttentionIconName,
        AttentionMovieName,
        ItemIsMenu
    };
    StatusNotifierModel();
    void addSource(const QString &serviceName, StatusNotifierItemSource *itemSource);
    void removeSource(const QString &serviceName);
    void removeAllSources();
    QList<QMap<QString, StatusNotifierItemSource*>> getItemServicesInfo();

public slots:
//    void addSource(const QString &source);
//    void removeSource(const QString &source);
    void dataUpdated(const QString &serviceName, StatusNotifierItemSource *itemSource, const QMap<uint, QVariant> &data);

private:
    void updateItemData(QStandardItem *dataItem, const QMap<uint, QVariant> &data, const Role role);

private:
//    QMap<QString, QVariant> Data; //存放Item的属性信息
    QStringList m_itemServices; //item服务列表，列表顺序和数据模型中的数据一致
    QList<QMap<QString, StatusNotifierItemSource*>> m_itemServicesInfo; //item服务详细列表
};

#endif // STATUSNOTIFIERMODEL_H
